﻿using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.AspNetCore.Mvc;

namespace B.S.DataBase.MyRead.API
{
    public class MyEx : IAsyncExceptionFilter
    {
        public Task OnExceptionAsync(ExceptionContext context)
        {
            if (!context.ExceptionHandled)
            {
                context.Result = new ContentResult()
                {
                    Content = "捕捉到全局异常！"
                };
            }
            context.ExceptionHandled = true;
            return Task.CompletedTask;
        }
    }
}
